<?php
namespace app\admin\validate;

use think\Validate;
class AdminUser extends Validate{
	protected $rule = [
		'username' => 'require',
		'password' => 'require',
		'captcha' => 'require|checkCapcha',
	];

	protected $message = [
		'username' => '用户名必须!',
		'password' => '密码必须!',
		'captcha' => '验证码必须!',
	];

	protected $scene = [
		'send_code' => ['phone_number'],
		'login' => ['phone_number','code','type'],
		'update_user' => ['username','sex'],
	];

	protected function checkCapcha($value,$rule,$data = []){
		if(!captcha_check($value)){
			//return '输入的验证码错误!';
		}

		return true;
	}
}